﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebSoftSeo.Models;

namespace WebSoftSeo.Controllers
{
    public class ServiceController : Controller
    {
        WebSoftSeoEntities db = new WebSoftSeoEntities();

        //
        // GET: /Service/

        public ActionResult Index()
        {
            ServicesDetail service1 = db.ServicesDetails.Where(m => m.Type == "1").FirstOrDefault();
            var service2 = db.ServicesDetails.Where(m => m.Type == "2").ToList();
            var service3 = db.ServicesDetails.Where(m => m.Type == "3").ToList();
            ViewBag.service2 = service2;
            ViewBag.service3 = service3;

            return View(service1);
        }
        public ActionResult Detail(string title, int id=0)
        {
            ServicesDetail service1 = db.ServicesDetails.Where(m => m.Type == "1").FirstOrDefault();
            ViewBag.Banner = service1;
            var service2Detail = db.ServicesDetails.Find(id);
            var service2 = db.ServicesDetails.Where(m => m.Type == "2").ToList();
            var service3 = db.ServicesDetails.Where(m => m.Type == "3").ToList();
            ViewBag.service2 = service2;
            ViewBag.service3 = service3;
            return View(service2Detail);
        }

    }
}
